﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Test.BLL;

namespace Test.Ul
{
    public partial class StuInfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GridView1.DataSource = StuInfoBLL.Select();
            GridView1.DataBind();
        }

        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            var data = e.Keys["id"];
            var id = Convert.ToInt32(data);

            if (StuInfoBLL.Delete(id) > 0)
            {
                var url = Request.Url.PathAndQuery;
                Response.Redirect(url);
            }
        }
    }
}